package com.szamc.tableroundapi.model.BaseTable;

import lombok.Data;

@Data
public class BaseTableFormatData {
    private String id;
    private double decimalPart;//小数部分
    private int IntegerPart ;//整数部分
    private double value ;//值
    private String fieldName;//列名
    private int fieldType;//列的类型
    private int rowIndex;//行序号


    public BaseTableFormatData(double value, String fieldName, int fieldType, int rowIndex) {

        this.id = rowIndex + "_" + fieldName;
        this.value = value;
        this.fieldName = fieldName;
        this.fieldType = fieldType;
        this.rowIndex = rowIndex;
        if(value >=0){
            this.decimalPart = value - Math.floor(value);
            this.IntegerPart = (int) Math.floor(value);
        }
        else{
            double absValue = Math.abs(value);
            this.IntegerPart = (int) Math.floor(value);
            this.decimalPart = value - Math.floor(value);
        }
    }


    public BaseTableFormatData() {
    }
}
